package com.foodlocker.sqlite;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {
	
	public static final int VERSION=1;
	public static final String DBNAME="db_machine";
	
	public static final String create_Tb_Order_Sql="CREATE TABLE IF NOT EXISTS tb_order"+
			"( " +
			"id INTEGER PRIMARY KEY ," +
			"customerTelnum VARCHAR ," +
			"supplierTelnum VARCHAR ," +
			"serviceTelnum VARCHAR ," +
			"secret VARCHAR ," +
			"boxesIn VARCHAR  ," +			
			"state INTEGER , " +	
			"dateAA VARCHAR ," +
			"timeFlag INTEGER , " +	
			"dateTimeAE VARCHAR ," +	
			"dateTimeAA VARCHAR ," +
			"dateTimeTK VARCHAR ," +
			"dateTimeTL VARCHAR ," +
			"dateTimeRL VARCHAR " +
			" )";  

			
	public DBHelper(Context context,CursorFactory factory){
		
		super(context,DBNAME,factory,VERSION);
	}
      public DBHelper(Context context){
		
		super(context,DBNAME,null,VERSION);
	}
	

	
	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		System.out.println("~~~~~~~~~~~~~~~~~~~~~~creat a database~~~~~~~~~~~~~~~~~~~~");
		db.execSQL(create_Tb_Order_Sql);
	
	/*	 db.execSQL("CREATE TABLE IF NOT EXISTS orderboxid" +  
	                "(orderdepositsecret VARCHAR  ,ordertakesecret VARCHAR  , boxid VARCHAR PRIMARY KEY, orderstate VARCHAR, customername VARCHAR,oid VARCHAR)");  
		        
		 db.execSQL("CREATE TABLE IF NOT EXISTS tb_box" +  
	                "( boxid VARCHAR PRIMARY KEY, boxstate VARCHAR)");   */
		
	}
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		System.out.println("upgrade a database");
	}

}
